package com.brillilab.service.core.lab.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.brillilab.common.entity.PageVo;
import com.brillilab.dao.mapper.lab.LabApplyRejectRecordMapper;
import com.brillilab.domain.po.lab.LabApplyRejectRecord;
import com.brillilab.service.core.lab.ILabApplyRejectRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 实验室申请拒绝记录 服务实现类
 * </p>
 *
 * @author zlb
 * @since 2019-07-12
 */
@Service
public class LabApplyRejectRecordServiceImpl extends ServiceImpl<LabApplyRejectRecordMapper, LabApplyRejectRecord> implements ILabApplyRejectRecordService {

    @Resource
    private LabApplyRejectRecordMapper labApplyRejectRecordMapper;

    @Override
    public LabApplyRejectRecord insert(LabApplyRejectRecord labApplyRejectRecord) {
        Integer b = labApplyRejectRecordMapper.insert(labApplyRejectRecord);
        return b == 1 ? labApplyRejectRecord : null;
    }

    @Override
    public List<LabApplyRejectRecord> selectListByApplyId(Long applyId) {
        LambdaQueryWrapper<LabApplyRejectRecord> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(LabApplyRejectRecord::getApplyId, applyId);
        return labApplyRejectRecordMapper.selectList(wrapper);
    }

    @Override
    public PageVo<LabApplyRejectRecord> selectPageVo(Page<LabApplyRejectRecord> page, Wrapper<LabApplyRejectRecord> wrapper) {
        IPage<LabApplyRejectRecord> iPage = labApplyRejectRecordMapper.selectPage(page, wrapper);
        return new PageVo<LabApplyRejectRecord>(iPage);
    }
}
